
// 迁移文件

'use strict';
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('Articles', {
      // id默认填充
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      //
      title: {
        type: Sequelize.STRING
      },
      content: {
        type: Sequelize.TEXT
      },

      // 新增时会填充现在的时间
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
       // 修改时会填充现在的时间
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },

  // down建表  dropTable删除表
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('Articles');
  }
};